package com.hsw.t2;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;

public class Test {
    public static void main(String[] args) {
        String s = "2022/1/22";
        //这里格式必须和字符串一样
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
        LocalDate ld = LocalDate.parse(s, dateTimeFormatter);
        System.out.println(ld);
    }
}
